package cn.good.yan.controller;

import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

/**
 * 演示 - nacos上的 复制均衡
 *
 * @author shengren.yan
 * @create 2022-04-06
 */
@RestController
public class OrderNacosController {
    @Resource
    private RestTemplate restTemplate;

    @Value("${service-url.nacos-user-service}")
    private String serverURL;

    @GetMapping(value = "/ccc/nacos/{id}")
    public String paymentInfo(@PathVariable("id") Integer id) {
        // 自动请求 - ${service-url.nacos-user-service}服务的接口 - 接口成功
        String result = restTemplate.getForObject(serverURL + "/nacos/" + id, String.class);
        return result + "\t" + "    我是OrderN服务端 - 83调用者。。。。。。";
    }

//    //===================================
//    @Resource
//    private PayFeignSentinelApi payFeignSentinelApi;
//
//    @GetMapping(value = "/consumer/pay/nacos/get/{orderNo}")
//    public ResultData getPayByOrderNo(@PathVariable("orderNo") String orderNo) {
//        return payFeignSentinelApi.getPayByOrderNo(orderNo);
//    }


}

